package cn.org.mrliu.ssm.common.web.view;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.servlet.view.document.AbstractXlsxView;

public class XlsxView extends AbstractXlsxView{

	@Override
	protected void buildExcelDocument(Map<String, Object> model, Workbook workbook, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		System.out.println(XlsxView.class);
		System.out.println(model);
		System.out.println(workbook);
        Sheet sheet = workbook.createSheet("Spring");
        sheet.setDefaultColumnWidth((short) 12);
        Row row = sheet.createRow(0);
        Cell cell = row.createCell(0);
        cell.setCellValue("Test Spring out Excel");
        cell = row.createCell(1);
        cell.setCellValue(String.valueOf(model.get("spring")));
        cell = row.createCell(2);
        cell.setCellValue(String.valueOf(model.get("excel")));
        cell = row.createCell(2);
        cell.setCellValue(String.valueOf(model.get("test")));
        
	}

}
